<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:wpf="clr-namespace:ViewOnAddInsAPI.Helper.WPF">

  <Style x:Key="{x:Type wpf:ChildWindowDecorator}" TargetType="{x:Type wpf:ChildWindowDecorator}">
    <Setter Property="Template">
      <Setter.Value>

        <ControlTemplate TargetType="{x:Type wpf:ChildWindowDecorator}">
          <Grid x:Name="griMain" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
                <SkewTransform AngleX="0" AngleY="0"/>
                <RotateTransform Angle="0"/>
                <TranslateTransform X="0" Y="0"/>
              </TransformGroup>
            </Grid.RenderTransform>

            <!-- Content -->
            <Border x:Name="root">

              <Grid x:Name="rootGrid">
                <Grid.RowDefinitions>
                  <RowDefinition Height="25"/>
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <!-- Background -->
                <Rectangle x:Name="background" Grid.Row="0" Grid.RowSpan="2" Fill="{DynamicResource VOColor10}" RadiusX="1" RadiusY="1" Stroke="{DynamicResource VOColor11}" StrokeThickness="1"/>
                <Border x:Name="headerBarBackground" Grid.Row="0" Background="{DynamicResource VOGradient01}"/>
                <Border x:Name="headerBar" Grid.Row="0" Background="#00ffffff">
                  <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                    <Button x:Name="btnMiniMode" Style="{DynamicResource WindowBarButton}" Margin="0,1,3,0" Visibility="Collapsed">
                      <Polygon
                                            Points="2,2 8,2 5,5"
                                            Fill="{DynamicResource VOColorIcon}"
                                            Stroke="{DynamicResource VOColorIcon}"
                                            StrokeThickness="1" />
                    </Button>
                    <Button Name="btnClose" HorizontalAlignment="Right" Style="{DynamicResource WindowBarButton}" IsEnabled="False">
                      <Viewbox>
                        <Canvas Height="10" Width="10">
                          <Line Fill="{DynamicResource VOColorIcon}" X2="9" X1="1" Stroke="{DynamicResource VOColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
                          <Line Fill="{DynamicResource VOColorIcon}" X2="1" X1="9" Stroke="{DynamicResource VOColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
                        </Canvas>
                      </Viewbox>
                    </Button>
                  </StackPanel>
                </Border>

                <!-- Content -->
                <AdornerDecorator Grid.Row="1" Margin="5,5,5,5">
                  <ContentPresenter Name="Content"/>
                </AdornerDecorator>

              </Grid>

            </Border>

            <!-- Grip -->
            <Grid Name="grip">
              <Border Name="rectSizeSouthEast" Background="#00FFFFFF"  Cursor="SizeNWSE" Width="16" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <Canvas Height="16" Width="16">
                  <Line X1="0" Y1="14" X2="14" Y2="0" Stroke="{DynamicResource VOColor13}" StrokeThickness="1"/>
                  <Line X1="4" Y1="14" X2="14" Y2="4" Stroke="{DynamicResource VOColor13}" StrokeThickness="1"/>
                  <Line X1="8" Y1="14" X2="14" Y2="8" Stroke="{DynamicResource VOColor13}" StrokeThickness="1"/>
                </Canvas>
              </Border>
            </Grid>

          </Grid>
          <ControlTemplate.Resources>
            <Storyboard x:Key="ShowChildWindow">
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
              </ObjectAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="griMain" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="griMain" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="HideChildWindow">
              <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00.2330000" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)">
                <DiscreteObjectKeyFrame KeyTime="00:00:00.2330000" Value="{x:Static Visibility.Collapsed}"/>
              </ObjectAnimationUsingKeyFrames>
              <!--DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.2330000" Value="0.8"/>
							</DoubleAnimationUsingKeyFrames>
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.2330000" Value="0.8"/>
							</DoubleAnimationUsingKeyFrames-->
            </Storyboard>
          </ControlTemplate.Resources>
        </ControlTemplate>

      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>
